﻿@model IEnumerable<FCNS.ERP.Models.ErpKq>

@{
    ViewBag.Title = "签到置疑修正";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>@ViewBag.Title</h2>
<hr />

<input type="button" id="selectAll" class="btn btn-default" value="全选" /> &nbsp;&nbsp;
<input type="button" id="mendAll" class="btn btn-default" value="修正" />&nbsp;&nbsp;
<input type="button" id="deleteAll" class="btn btn-default" value="删除" />
<script type="text/javascript">
    $(document).ready(function () {
        var isSelect = false;

        $("#selectAll").click(function () {
            isSelect = !isSelect;
            $(":checkbox").prop("checked", isSelect);
        });

        $("#mendAll").click(function () {
            var p = Number(prompt("请输入考勤编号"));
            if (Number.isInteger(p) == false) {
                alert("考勤编号应该为整数");
            }
            else {
                var mend = '';
                $(":checked").each(function () {
                    mend += ($(this).prev().val() + ".");
                });
                $.post("/Px/KqMend", {id:p, idString: mend });
                window.location.replace("/Px/KqZy");
            }
        });

        $("#deleteAll").click(function () {
            if (confirm("确定要删除吗") == true) {
                var del = '';
                $(":checked").each(function () {
                    del += ($(this).prev().val() + ".");
                }); 
                $.post("/Px/KqDelete", { idString: del });
                window.location.replace("/Px/KqZy");
            }
        });
    });
</script>
<p></p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.DateTimeStart)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.KqId)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DeviceNO)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.DateTimeStart)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.KqId)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DeviceNO)
            </td>
            <td>
                <input type="hidden" value=@item.Id />
                <input type="checkbox" />
            </td>
        </tr>
    }

</table>
